﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace HRLib
{

    public class Company : TaxEntity
    {
        private IList<TaxEntity> employees;

        protected Company()
        { }

        public Company(string name, string tid)
            : base(name, tid)
        {
            employees = new List<TaxEntity>();
        }

        public override string TaxIdRegex
        {
            get { return @"^\d\d-\d{7}$"; }
        }

        public IEnumerable<TaxEntity> AllJohnEmployees
        {
            get
            {
                return employees.Where(t => t.Name == "John");
            }
        }

        delegate void noparms(int x, int y);

        bool check(TaxEntity t)
        {
            noparms myfunc = (int a, int b) => Console.Write("yup"+ (a + b));
            myfunc(5,6);


            return t.Name == "John";
        }

        public ICollection<TaxEntity> Employees
        {
            get { return employees; }
        }

        public void Hire(TaxEntity newHire)
        {
            employees.Add(newHire);
        }

        /// <summary>
        /// Pay all the employees in this company.
        /// </summary>
        /// <returns></returns>
        public override float Pay()
        {
            float totalnet = 0;
            foreach (TaxEntity p in employees)
            {
                totalnet += p.Pay();
            }
            return totalnet;
        }

       
    }
}
